# -*- coding: utf-8 -*-
"""
Created on Wed Feb 20 23:19:37 2013

@author: eaponte
"""
import re
f = '''eyelink_node_send 
eyelink_node_receive 
eyelink_send_command 
eyelink_command_result 
eyelink_timed_command 
eyelink_last_message 
eyelink_send_message 
eyelink_node_send_message 
eyelink_send_message_ex 
eyelink_node_send_message_ex 
eyelink_read_request 
eyelink_read_reply 
eyelink_position_prescaler 
eyelink_reset_data 
eyelink_data_status 
eyelink_get_next_data 
eyelink_get_last_data 
eyelink_newest_sample 
eyelink_get_float_data 
eyelink_newest_float_sample 
eyelink_eye_available 
eyelink_sample_data_flags 
eyelink_event_data_flags 
eyelink_event_type_flags 
eyelink_data_count 
eyelink_wait_for_data 
eyelink_get_sample 
eyelink_data_switch 
eyelink_data_start 
eyelink_data_stop 
eyecmd_printf 
eyemsg_printf 
eyemsg_printf_ex'''

funs = re.findall('\w+',f)

conts = '''
"""
Created on Tue Feb 19 14:55:43 2013

@author: aponteeduarddo@gmail.com
Copyright Eduardo Aponte 2013.
"""

from mex_binder import binder_py

{0} = binder_py('{0}')
{0}.mx_c.headers = ['<eyelink.h>','"mex.h"']
{0}.bindo += []
{0}.mx_c.code = \\
"""
"""

{0}.mx_c.mdoc = \\
"""function [ ] = mx_{0}( )
%MX_{1}
"""
{0}.write_c()
{0}.write_m()
{0}.compile()
{0}.write_sh()

'''

for f in funs:
    with open('./src/msg_utils/mx_{0}.py'.format(f),'w') as ftmp:
        ftmp.write(conts.format(f,f.upper()))
        

